﻿using System;
using System.Linq;
using Enyim.Caching;
using Ayatta.Contract;
using Web.Base.Extensions;
using Web.My.Models;
using System.Web.Mvc;
using Web.Base.Security;
using Ayatta.Contract.Domain;

namespace Web.My.Controllers
{
    public class IntegralController : MyBaseController
    {
        public IntegralController(ILogService logService, IBaseService baseService, IExtraService extraService, IStoreService storeService, IOrderService orderService, IGameService gameService, IAuctionService auctionService, IPassportService passportService, IPaymentService paymentService, IMemcachedClient memcachedClient)
            : base(logService, baseService, extraService, storeService, orderService, gameService, auctionService, passportService, paymentService, memcachedClient)
        {
        }

        /// <summary>
        /// 积分
        /// </summary>
        /// <param name="category"></param>
        /// <param name="status"></param>
        /// <param name="index"></param>
        /// <param name="size"></param>
        /// <returns></returns>
        public ActionResult Index(IntegralCategory? category = null, IntegralStatus? status = null, int index = 1, int size = 20)
        {
            var identity = User.Identity.Identity();
            var model = new IntegralControllerModel.Index();
            var pointDetails = PaymentService.GetPagedUserIntegral(identity.Id, category, status, index, size);
            model.PointDetails = pointDetails.ToPagedList(index, size);
            return View(model);
        }

        /// <summary>
        /// 积分兑换
        /// </summary>
        /// <returns></returns>
        public ActionResult Exchange()
        {
            return View();
        }

    }
}
